home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 051-075 / disk_069 / sb / sbgraphics.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  5KB  |  143 lines

  1. /* include not needed for Aztec C using provided makefile */
  2. #include "sb:sb.h"
  3. extern int level;
  4. extern void PrPlanes(), PrRastPort2();
  5.  
  6.  
  7. void PrBitMap(string, bitmap) char *string; struct BitMap *bitmap;
  8. {
  9. static struct StructData structdata[] = {
  10.      { "-BytesPerRow", "UWORD",   12, INTSIZE    },
  11.      { "-Rows",        "UWORD",   12, INTSIZE    },
  12.      { "-Flags",       "UBYTE",   13, BYTESIZE   },
  13.      { "-Depth",       "UBYTE",   13, BYTESIZE   },
  14.      { "-Pad",         "UWORD",   12, INTSIZE    },
  15.      { " Planes[8]",   "PLANEPTR", 5, PTRSIZE * 8}
  16.   };
  17. int sum, choice = -1;
  18.   level++;
  19.   while (choice) {
  20.     sum = SetOptionText(string, structdata,
  21.                          (APTR)bitmap, DATASIZE, 0);
  22.     if ((choice = GetChoice(DATASIZE)) == 6)
  23.       PrPlanes("BitPlanes belong to the BitMap", bitmap->Planes,
  24.                bitmap->Rows, bitmap->BytesPerRow);
  25.   }
  26.   level--;
  27. }
  28.  
  29.  
  30. void PrPlanes(string, planes, rows, bytes)
  31. char *string; PLANEPTR planes[]; UWORD rows, bytes;
  32. {
  33. static struct StructData structdata[] = {
  34.      {" BitPlabe[0]",   "PLANEPTR", 5, PTRSIZE },
  35.      {" BitPlabe[1]",   "PLANEPTR", 5, PTRSIZE },
  36.      {" BitPlabe[2]",   "PLANEPTR", 5, PTRSIZE },
  37.      {" BitPlabe[3]",   "PLANEPTR", 5, PTRSIZE },
  38.      {" BitPlabe[4]",   "PLANEPTR", 5, PTRSIZE },
  39.      {" BitPlabe[5]",   "PLANEPTR", 5, PTRSIZE },
  40.      {" BitPlabe[6]",   "PLANEPTR", 5, PTRSIZE },
  41.      {" BitPlabe[7]",   "PLANEPTR", 5, PTRSIZE }
  42.   };
  43. int sum, choice = -1;
  44.   level++;
  45.   while (choice) {
  46.     sum = SetOptionText(string, structdata,
  47.                         (APTR)planes, DATASIZE, 0);
  48.     choice = GetChoice(8);
  49.     if (choice >= 1 && choice <= 8 && planes[choice - 1])
  50.       HexDump(structdata[choice - 1].membername,
  51.               planes[choice - 1], PTRSIZE, (long)(rows * bytes));
  52.   }
  53.   level--;
  54. }
  55.  
  56.  
  57. void PrRastPort(string, rastport) char *string; struct RastPort *rastport;
  58. {
  59. static struct StructData structdata[] = {
  60.      { "(Layer",      "struct Layer *)",     5, PTRSIZE  },
  61.      { " BitMap",     "struct BitMap *",     5, PTRSIZE  },
  62.      { "-Area Ptrn",  "USHORT *",            5, PTRSIZE  },
  63.      { "(TmpRas",     "struct TmpRas *)",    5, PTRSIZE  },
  64.      { "(AreaInfo",   "struct AreaInfo *)",  5, PTRSIZE  },
  65.      { "(GelsInfo",   "struct GelsInfo *)",  5, PTRSIZE  },
  66.      { "-Mask",       "UBYTE",              13, BYTESIZE },
  67.      { "-FgPen",      "BYTE",                3, BYTESIZE },
  68.      { "-BgPen",      "BYTE",                3, BYTESIZE },
  69.      { "-AOlPen",     "BYTE",                3, BYTESIZE },
  70.      { "-DrawMode",   "BYTE",                3, BYTESIZE },
  71.      { "-AreaPtSize", "BYTE",                3, BYTESIZE },
  72.      { "-linpatcnt",  "BYTE",                3, BYTESIZE },
  73.      { "-dummy",      "BYTE",                3, BYTESIZE },
  74.      { "(Flags",      "USHORT",             12, INTSIZE  },
  75.      { "-LinePtrn",   "USHORT",             12, INTSIZE  }
  76.   };
  77. int sum, choice = -1;
  78.   level++;
  79.   while (choice) {
  80.     sum = SetOptionText(string, structdata,
  81.                         (APTR)rastport, DATASIZE, 0);
  82.     switch (choice = GetChoice(MAXGADG + 1)) {
  83.       case 2:
  84.         if (rastport->BitMap)
  85.           PrBitMap("The BitMap for the RastPort", rastport->BitMap);
  86.         break;
  87.       case MOREGADG:
  88.         PrRastPort2("More RastPort members", rastport, sum);
  89.         break;
  90.     }
  91.   }
  92.   level--;
  93. }
  94.  
  95.  
  96. void PrRastPort2(string, rastport, offset)
  97. char *string; struct RastPort *rastport; int offset;
  98. {
  99. static struct StructData structdata[] = {
  100.      {"-cp_x",            "SHORT",             2, INTSIZE     },
  101.      {"-cp_y",            "SHORT",             2, INTSIZE     },
  102.      {" minterms[8]",     "UBYTE",             0, BYTESIZE * 8},
  103.      {"-PenWidth",        "SHORT",             2, INTSIZE     },
  104.      {"-PenHeight",       "SHORT",             2, INTSIZE     },
  105.      {"(TextFont",        "struct Font *)",    5, PTRSIZE     },
  106.      {"-AlgoStyle",       "UBYTE",            13, BYTESIZE    },
  107.      {"(TxFlags",         "UBYTE",            13, BYTESIZE    },
  108.      {"-TxHeight",        "UWORD",            12, INTSIZE     },
  109.      {"-TxWidth",         "UWORD",            12, INTSIZE     },
  110.      {"-TxBaseLine",      "UWORD",            12, INTSIZE     },
  111.      {"-TxSpacing",       "WORD",              2, INTSIZE     },
  112.      {"-RP_User",         "WORD",              2, INTSIZE     },
  113.      {" wordreserved[7]", "UWORD",             0, INTSIZE * 7 },
  114.      {" longreserved[2]", "ULONG",             0, PTRSIZE * 2 },
  115.      {" reserved[8]",     "UBYTE",             0, BYTESIZE * 8}
  116.   };
  117. int sum, choice = -1;
  118.   level++;
  119.   while (choice) {
  120.     sum = SetOptionText(string, structdata,
  121.                         (APTR)rastport, DATASIZE, offset);
  122.     switch (choice = GetChoice(DATASIZE)) {
  123.       case 3:
  124.         HexDump("Hexdump of RastPort minterms bytes",
  125.                 &rastport->minterms[0], BYTESIZE, (long)BYTESIZE * 8);
  126.         break;
  127.       case 14:
  128.         HexDump("Hexdump of reserved RastPort words",
  129.                 &rastport->wordreserved[0], INTSIZE, (long)INTSIZE * 7);
  130.         break;
  131.       case 15:
  132.         HexDump("Hexdump of reserved RastPort longwords",
  133.                 &rastport->longreserved[0], PTRSIZE, (long)PTRSIZE * 2);
  134.         break;
  135.       case 16:
  136.         HexDump("Hexdump of reserved RastPort bytes",
  137.                 &rastport->reserved[0], BYTESIZE, (long)BYTESIZE * 8);
  138.         break;
  139.     }
  140.   }
  141.   level--;
  142. }
  143.